Current Location: Home> Function Categories> chroot

chroot

Change the root directory
Name:chroot
Category:Directory functions
Programming Language:php
One-line Description:Change the root directory.

Definition and usage

chroot() function changes the root directory of the current process to directory and changes the current working directory to "/".

Note: This function requires root permissions and is only available on GNU and BSD systems when using CLI, CGI, Embedded SAPI. This function is not implemented on the Windows platform.

Example

Change the root directory:

 <?php
// Change the root directory
chroot ( "/path/to/chroot/" ) ;

// Obtain the current directory
echo getcwd ( ) ;
?>

Results:

 /

grammar

 chroot ( directory ) ;
parameter describe
Directory Required. Specify the new root directory path.
Similar Functions
Popular Articles